<?php

namespace app\api\controller;

use think\Db;
use app\common\controller\Api;

/****
 * Class    Order
 * @name    订单API文件
 * @author  晓月老板<1434926265@qq.com>
 * @date    2020/05/21 09:24 AM
 * @package app\api\controller
 */
class Order extends Api
{

    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /***
     * @name    订单详情API接口
     * @author  晓月老板<1434926265@qq.com>
     * @date    2020/07/22 10:40 AM
     * @return  string<json>
     */
    public function order_info()
    {

        // 获取订单ID
        $order_id = $this->request->request("order_id",0,"intval");

        if($order_id == 0){
            $this->error("参数错误");
        }

        // 查询分类商品数据
        $order_info = Db::name('order b')
                        ->where(['b.id'=>$order_id])
                        ->join('shopro_goods a','a.id =b.pid','LEFT')
                        ->join('coupon cp','cp.id =b.coupon_id','LEFT')
                        ->join('address c','c.id = b.site_id','LEFT')
                        ->join('manystore s','s.id =b.mid','LEFT')
                        ->field('a.*,b.*,s.*,cp.*,c.name,c.phone,c.dispatching,c.particular,cp.sum')
                        ->find();

        $this->success('请求成功', $order_info);

    }


}
